home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: new-news.sprintlink.net!eskimo!news
- From: mag@eskimo.com (mAg)
- Subject: Re: What happens on realloc() failure?
- X-Nntp-Posting-Host: tia1.eskimo.com
- Message-ID: <DotG06.4n8@eskimo.com>
- Sender: news@eskimo.com (News User Id)
- Organization: *.*
- X-Newsreader: WinVN 0.93.10
- References: <Pine.SOL.3.91-941213.960322192958.24127A-100000@aidan.ncl.ac.uk>
- Date: Mon, 25 Mar 1996 09:07:17 GMT
-
- In article <Pine.SOL.3.91-941213.960322192958.24127A-100000@aidan.ncl.ac.uk> (Fri, 22 Mar
- 1996 19:37:44 +0000), T.W.Seddon@ncl.ac.uk says :
- >
- << stuff deleted >>
- >
- >Since realloc() returns NULL on failure, is it safe to use the pointer to
- >the malloc()ed area I was trying to resize? Or will the old area have
- >been freed by free() and now be unusable? What does the ANSI standard
- >have to say about this? I've never seen anything about this point before
- >(although if it's in the FAQ I apologise, I must have missed it :-( )
- << stuff deleted >>
-
- Article 7.10.3.4 ANSI C specifically states
- ".... If the object cannot be allocated, the object pointed to by ptr is unchanged. ..."
-
- --
- /* --------------------------------------------------------
- MAG@ESKIMO.COM
- http://www.eskimo.com/~mag/index.html
- ***********************************************************
- To understand recursion one must first understand recursion
- ***********************************************************
- -------------------------------------------------------- */
-
-